import Vue from "vue";
import Router from "vue-router";
import vm from "@/main";
const IMap = () => import("@/pages/IMap.vue");
const VueIMap = () => import("@/pages/VueIMap");
const Loop = () => import("@/pages/loop");
const Test = () => import("@/components/test");
const White = () => import("@/pages/white");

Vue.use(Router);

const routes = [
  {
    path: "/imap",
    name: "IMap",
    component: IMap
  },
  {
    path: "/vue-imap",
    name: "VueIMap",
    component: VueIMap
  },
  {
    path: "/loop",
    name: "Loop",
    component: Loop
  },
  {
    path: "/test",
    name: "Test",
    component: Test
  },
  {
    path: "/white",
    name: "White",
    component: White
  }
];
const router = new Router({
  mode: "history",

  routes,
  scrollBehavior(to, from, savedPosition) {
    return { x: 0, y: 0 };
  }
});
router.beforeEach((to, from, next) => {
  // console.log(vm);
  next();
});

export default router;
